<?php
	require_once 'BPNet.php';
	ReadValue();
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>

<body>
<?php
	if(empty($_POST['app1'])||empty($_POST['app2']))
	{
?>
		<form action="predict.php" method="post">
		<input type="text" name="app1">
		<input type="text" name="app2">
		<input type="submit" name="" value="提交">
		</form>
<?php
	}
	else{
		$file_path = 'deal_data/day_files/';
		$handle = opendir($file_path);
		$k = 0;
		while(($item = readdir($handle))!==false)
		{
			if(($item!=='.')&&($item!=='..'))
			{
				$arr_file[$k] = $item;
				$k++;
			}
		}
		// var_dump($arr_file);
		$k--;
		$flag = 0;
		$search_app = $_POST['app1'].' '.$_POST['app2'];
		while($k!=0)
		{
			$fp = fopen($arr_file[$k]);
			while(!feof($fp))
			{
				$line = fgets($fp);
				echo $line;
				$flag = 1;
				// if(strpos($line, $search_app))
				// {
				// 	$flag = 1;
				// 	break;
				// }
			}
			if($flag == 1)
			{
				break;
			}
			$k--;
		}
		var_dump($line);
	}
?>
	
</body>
</html>